package com.hbnu.iostream;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;

public class InputStreamReaderDemo1 {
    public static void main(String[] args) {
        String path = "C:" + File.separator +"Users" + File.separator +"TX" + File.separator +"IdeaProjects" + File.separator +"javalean" + File.separator +"src" + File.separator +"com" + File.separator +"hbnu" + File.separator +"iostream" + File.separator +"test.txt";

        File file = new File(path);
        try {
            InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(file));
            char[] result = new char[1024];
            int len = inputStreamReader.read(result);

            System.out.println(new String(result,0,len));
            inputStreamReader.close();
        }
        catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
